package com.spring.netty.message;

import org.springframework.stereotype.Service;

import java.time.LocalDateTime;

// MessageServiceImpl.java
@Service
public class MessageServiceImpl implements MessageService {
    @Override
    public String processMessage(String message) {
        // 实际业务逻辑处理
        System.out.println("处理消息: " + message);

        // 示例：简单回复
        if (message.equalsIgnoreCase("hello")) {
            return "Welcome to Netty Server!";
        } else if (message.equalsIgnoreCase("time")) {
            return LocalDateTime.now().toString();
        }

        return "Received: " + message;
    }
}
